<template>
	<view style="padding: 40rpx;">
		<up-input v-model="phone" shape="circle" disabled></up-input>
		<up-input password v-model="oldPwd" shape="circle" style="margin-top: 20rpx;" placeholder="请输入旧密码"></up-input>
		<up-input password v-model="pwd" shape="circle" style="margin-top: 20rpx;" placeholder="请输入新密码"></up-input>

		<view class="" style="padding: 40rpx;">
			<up-button type="error" shape="circle" text="提交" @click="save"></up-button>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'
	import md5 from 'js-md5'
	import mineApi from '../../../api/mine';
	const user = JSON.parse(uni.getStorageSync("user"));
	const phone = ref(user.Mobile);
	const oldPwd = ref("")
	const pwd = ref("")
	const save = async () => {
		const res = await mineApi.changePwd({
			app: 4,
			userName: user.Account,
			password: oldPwd.value,
			newPassword: pwd.value
		});
		if (res.code === 200) {
			uni.showToast({
				icon: 'none',
				title: " 修改成功",
			});
			setTimeout(() => {
				uni.navigateBack()
			}, 500);
		}
	}
</script>

<style>

</style>